@extends('layouts.admin.application')
@section('content')

    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">充值管理</strong> /
                    <small>List</small>
                </div>
            </div>
            @include('admin._flash')
            <hr>


            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-12">
                    <form class="am-form-inline" method="get">
                        <div class="am-form-group">
                            <select data-am-selected="{btnSize: 'sm', maxHeight: 360, searchBox: 1}"
                                    name="statu">
                                <option value="-1"  >请选择公司或个人</option>
                                <option value="0"@if(Request::input('statu')==0 &&Request::input('statu')!='' )selected @endif>个人</option>
                                <option value="1"@if(Request::input('statu')==1)selected @endif>公司</option>

                            </select>
                            <div class="am-input-group am-input-group-sm">
                                <input type="text" class="am-form-field" name="name"
                                       value="{{Request::input('name')}}" placeholder="公司名或会员名搜索">
                            </div>

                            <div class="am-input-group am-input-group-sm">
                                <input type="text" class="am-form-field" name="tel"
                                       value="{{Request::input('tel')}}" placeholder="会员电话或公司电话搜索">
                            </div>



                            <div class="am-form-group">
                                <select data-am-selected="{btnSize: 'sm', maxHeight: 360, searchBox: 1}"
                                        name="store_id">
                                    <option value="-1">所有门店</option>
                                    @foreach($cates as $c)
                                        <option value="{{$c->id}}"
                                                @if(Request::input('store_id')==$c->id) selected @endif>{{$c->name}}</option>
                                    @endforeach
                                </select>
                            </div>


                        </div>

                        <div class="am-form-group" style="margin-top: 3px">
                            <button type="submit" class="am-btn am-btn-default am-btn-sm">查询</button>
                            <a href="/admin/order/redeposit" class="am-btn am-btn-default am-btn-sm">重置</a>
                        </div>
                    </form>
                </div>

            </div>
            <hr>


            <div class="am-g">
                <div class="am-u-sm-12">
                    <form class="am-form">
                        <table class="am-table am-table-striped am-table-hover table-main">
                            <thead>
                            <tr style="font-size: 1.6rem">

                                <th class="table-id">ID</th>
                                <th class="table-type">会员或公司名</th>
                                <th class="table-type">会员或公司联系人手机号</th>
                                <th class="table-type">充值金额</th>
                                <th class="table-type">操作员</th>
                                <th class="table-type">所属门店</th>
                                <th class="table-type">充值时间</th>
                                {{--<th class="table-set">操作</th>--}}
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($deposits as  $k=> $d)
                                <tr data-id="" style="font-size: 1.6rem">

                                    <td>{{$k+1}}</td>

                                    <td>
                                        <label class="am-btn am-btn-danger am-btn-xs am-radius" >
                                            {{$d['oncustomer']['name'] or $d['company']['name']}}
                                        </label>
                                    </td>
                                    <td>
                                        {{$d['oncustomer']['tel'] or $d['company']['linkman_tel']   }}
                                    </td>

                                    <td>
                                        <label class=" am-btn-secondary am-btn am-btn-xs am-radius">
                                            {{$d->deposit_number}}元
                                        </label>
                                    </td>

                                    <td>
                                        <label class=" am-btn-secondary am-btn am-btn-xs am-radius">
                                            {{$d->contro}}
                                        </label>



                                    </td>

                                    <td>

                                        <label class="am-btn am-btn-danger am-btn-xs am-radius" >
                                            {{$d['store']['name']}}
                                        </label>

                                    </td>

                                    <td>
                                        {{$d->created_at}}
                                    </td>


                                    {{--<td>--}}
                                        {{--<div class="am-btn-toolbar">--}}
                                            {{--<div class="am-btn-group am-btn-group-xs">--}}
                                                {{--<a href="/"--}}
                                                   {{--class="am-btn am-btn-primary am-btn-xs"><span--}}
                                                            {{--class="am-icon-pencil-square-o"></span> 编辑--}}
                                                {{--</a>--}}
                                                {{--<a href="/"--}}
                                                   {{--data-method="delete"--}}
                                                   {{--data-token="{{csrf_token()}}" data-confirm="确认删除吗?"--}}
                                                   {{--class="am-btn am-btn-danger am-btn-xs del_one">--}}
                                                    {{--<span class="am-icon-trash-o"></span> 删除--}}
                                                {{--</a>--}}
                                            {{--</div>--}}
                                        {{--</div>--}}
                                    {{--</td>--}}
                                </tr>
                            @endforeach


                            </tbody>
                        </table>
                        共 {{$deposits->total()}} 条记录

                        <div class="am-cf">
                            <div class="am-fr">
                                {!! $deposits->appends(Request::all())->links() !!}
                            </div>
                        </div>
                        <hr/>
                        <p>注：.....</p>
                    </form>
                </div>

            </div>
        </div>

        <footer class="admin-content-footer">
            <hr>
            <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
        </footer>

    </div>


@endsection
@section('js')
    <script src="/vendor/daterangepicker/moment.js"></script>
    <script src="/vendor/moment/locale/zh-cn.js"></script>
    <script src="/vendor/daterangepicker/daterangepicker.js"></script>

    <script>
        $(function () {
            //时间插件
            $('#date_start').daterangepicker({

                "autoUpdateInput": false,
                "autoApply": true,
                "locale": {
                    "format": "YYYY-MM-DD",
                    "applyLabel": "确定",
                    "cancelLabel": "取消"
                }
            }, function (start, end, label) {
                this.element[0].value = start.format('YYYY-MM-DD') + ' ~ ' + end.format('YYYY-MM-DD');
            });
        });

    </script>
@endsection